package com.dao;

import java.sql.Connection;
import java.util.Properties;
import java.io.*;
import java.sql.DriverManager;
public class SimpleDBSource implements DBSource{

	
	public Connection getConn() {

		Connection conn = null;
		try{
			String driver = "com.mysql.jdbc.Driver";
			String url = "jdbc:mysql://localhost:3306/bank?useUnicode=true&characterEncoding=UTF-8";
			String username = "root";
			String password = "123456";
			Class.forName(driver);
			conn = DriverManager.getConnection(url,username,password);
			
		}catch(Exception ex){
			ex.printStackTrace();
		}
	
		return conn;
	}

	
	public void closeConn(Connection conn) {
        try{
			if(!conn.isClosed() && conn!=null)
			{
				conn.close();
			}
		}catch(Exception ex){
			ex.printStackTrace();
		}	
	}
}
